package org.xtense.tests;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

import org.xtense.data.DBConfig;
import org.xtense.data.DBManager;
import org.xtense.engine.IConstants;
import org.xtense.engine.XtenseFactory;
import org.xtense.model.CSubSet;

public class EngineTest {
	public static void main(String[] args) {


		DBManager m = new DBManager(DBConfig.getInstance(true,null));
			String sqlE = "select * from element";
			String sqlA = "select * from attribute";
			String sqlT = "select * from text";
			// String sqlDss = "select * from document";
			XtenseFactory factory = XtenseFactory.instance();
			CSubSet c = factory.createResultSetForQuery(1);
			factory.generateResulte(c, m.executeSqlQuery(sqlE),
					IConstants.ELEMENT);
			factory.generateResulte(c, m.executeSqlQuery(sqlA),
					IConstants.ATTRIBUTE);
			factory.generateResulte(c, m.executeSqlQuery(sqlT),
					IConstants.TEXT);
			// XtenseFactory.generateResulte(c, sm.executeQuery(sqlD),
			// IConstants.DOCUMENT);
			try {
				c.prettyWrite();
			} catch (UnsupportedEncodingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
	}
}
